@import 'mixins';
@import 'vars';

/* stylelint-disable */

body {
    // Default body with padding for fixed navbar and sidebar.
    & {
        background: $color-background;
        padding-left: 0;
        padding-top: $size-navbar-height;
    }

    // White body for login and profile page.
    &.white {
        background: $color-white;
    }
}

hr {
    border-color: $color-border;
}

// Common style for user email.
.user-email {
    font-size: .8rem;
    font-style: italic;
}

.text-decent {
    color: $color-text-decent;
}

.text-nowrap {
    white-space: nowrap;
}

.text-break-all {
    word-break: break-all;
}

.text-sm {
    font-size: $font-small;
}

.rounded-full {
    border-radius: 100%;
}

.drag-handle {
    color: $color-text-decent;
    cursor: move;
    font-size: 1.1rem;
    font-weight: normal;
}

.drag-none {
    @include no-drag;
}

//
// Rich editor icon. Must be placed here, because element is not created by angular.
//
.mce-i-assets {
    & {
        font-family: 'icomoon' !important;
    }

    &::before {
        content: '\e948';
    }
}

.cdk-drag-placeholder {
    opacity: 0;
}

.cdk-drag-animating {
    transition: transform 250ms cubic-bezier(0, 0, .2, 1);
}

.cdk-drop-list-dragging {
    * {
        transition: transform 250ms cubic-bezier(0, 0, .2, 1);
    }

    .cdk-drag-placeholder {
        transition: none;
    }
}

.cdk-drag-preview {
    opacity: .7;

    &.table-drag {
        display: table;

        &::before {
            @include force-height(100%);
            background: $color-white;
            border: 2px dashed darken($color-border, 5%);
            border-radius: 2px;
            display: block;
            content: '';
        }

        * {
            display: none;
        }
    }
}

.icon-bold {
    font-weight: bold;
}

//
// Help texts
//
.help {
    & {
        font-size: 90%;
    }

    h2,
    h3,
    h4 {
        margin-top: 1rem;
    }

    pre {
        @include text-code;
        background: $color-code-background;
        margin: .25rem 0;
        padding-left: .5rem;
        padding-right: 3rem;
    }

    a {
        white-space: nowrap;
    }

    table {
        width: 100%;

        td, th {
            border: 1px solid $color-border;
            border-radius: 0;
            padding: .25rem .5rem;
        }
    }

    sqx-form-hint {
        small {
            font-size: 100%;
        }
    }
}

//
// Code
//
.code {
    background: $color-code-background;
    margin: .25rem 0;
    padding-left: .5rem;
    padding-right: 3rem;
}
.code,
.code-copy {
    @include text-code;
    min-height: 27px;
    padding-bottom: .25rem;
    padding-top: .25rem;
}

.code-container {
    position: relative;
}

.code-copy {
    @include absolute(0, 0, auto, auto);
    background: darken($color-border-dark, 30%);
    border: 0;
    color: $color-white;
    padding-left: .375rem;
    padding-right: .375rem;

    &:focus {
        background: darken($color-border-dark, 40%);
    }
}

//
// Profile picture in circle
//
.user-picture {
    & {
        @include circle(2rem);
    }

    &:not([src]) {
        opacity: 0;
    }
}

.truncate {
    @include truncate;
}

.squid {
    @include circle(50px);
    align-items: center;
    background: $color-white;
    display: flex;
    flex-grow: 1;
    flex-wrap: nowrap;
    justify-content: center;

    &.bordered {
        border: 1px solid $color-border;
    }

    img {
        max-height: 70%;
    }

    &-sm {
        @include circle(32px);
    }
}

.ngx-ui-tour_backdrop {
    & {
        z-index: 1040 !important;
    }
}

//
// Green or red circle if element is published or unpublished
//
.item-published {
    & {
        @include circle(.5rem);
        background: $color-theme-success;
        border: 0;
        margin-left: .4rem;
    }

    &.unpublished {
        background: $color-theme-error;
    }
}

.dropdown-item {
    cursor: pointer;
}

//
// Landing page with loading spinner.
//
.landing-page {
    & {
        margin: 8rem auto;
        max-width: 32rem;
        text-align: center;
    }

    h1 {
        margin-top: 2.5rem;
    }

    .logo {
        height: 4rem;
    }
}

// Hidden helper (fast *ngIf replacement)
.hidden {
    display: none;
}

.hidden-important {
    display: none !important;
}

// Hidden helper (fast *ngIf replacement)
.invisible {
    visibility: hidden;
}

//
// Drop area for drag and drop features.
//
.drop-container {
    & {
        position: relative;
    }

    .drop-area {
        & {
            @include absolute(30px, 30px, 30px, 30px);
            align-content: center;
            align-items: center;
            border: 2px dashed $color-border;
            border-radius: $border-radius;
            color: darken($color-border, 30%);
            display: none;
            font-size: 1.2rem;
            font-weight: normal;
            justify-content: center;
            z-index: 10;
        }

        &.dragging {
            display: flex;
        }

        &.drag {
            border-color: darken($color-border, 10%);
            color: darken($color-border, 40%);
            cursor: copy;
            text-decoration: none;
        }
    }

    .drop-text {
        background: $color-white;
    }
}

.sorting {
    &,
    & > * {
        opacity: .5;
    }
}

.no-focus-shadow {
    &:focus {
        box-shadow: none;
    }
}

.sidebar {
    @include absolute($size-navbar-height, null, 0, 0);
    background: $color-theme-brand;
    color: $color-white;
    font-size: $font-small;
    font-weight: default;
    overflow: hidden;
    width: $size-sidebar-width;

    .bottom {
        @include absolute(null, 0, 0, 0);
    }

    .nav-item {
        max-width: 100%;
    }

    .nav-link {
        background: $color-theme-brand;
        color: $color-white !important;
        cursor: pointer;
        padding: 1rem 0;
        transition: background-color .4s ease;
        text-align: center;
        text-decoration: none;

        &:hover {
            background: $color-theme-brand-darker;
        }

        &.active {
            background: $color-theme-brand-darker;
        }

        i {
            font-size: 1.1rem;
        }
    }

    .nav-text {
        @include truncate;
        margin-top: .5rem;
    }
}

//
// Status Icon
//
.status-icon {
    & {
        @include circle-icon(2rem);
        background: $color-border;
        border: 0;
        color: $color-white;
        display: inline-block;
    }

    &-sm {
        @include circle-icon(1.6rem);
    }

    &-lg {
        @include circle-icon(2.8rem);
    }

    &-pending {
        color: $color-text;
    }

    &-warning {
        background: $color-theme-warning;
    }

    &-failed {
        background: $color-theme-error;
    }

    &-success {
        background: $color-theme-success;
    }
}

//
// ACE
//
.ace_tooltip {
    background: $color-white;
    border: 1px solid $color-input;
    border-radius: 0;
    font-size: 14px;
    max-width: 300px;
    min-width: 100px;
    white-space: pre-wrap;

    hr {
        margin: .5rem 0;
    }
}

//
// Animations
//
.spin {
    animation: spin 3s infinite linear;
}

.spin2 {
    animation: spin2 1s infinite linear;
}

i {
    &.spin {
        display: inline-block;
    }

    &.spin2 {
        display: inline-block;
    }
}

@keyframes spin2 {
    50% {
        transform: rotate(180deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes spin {
    20% {
        transform: rotate(0deg);
    }

    30% {
        transform: rotate(180deg);
    }

    70% {
        transform: rotate(180deg);
    }

    80% {
        transform: rotate(360deg);
    }

    100% {
        transform: rotate(360deg);
    }
}